Install the http-server globally on machine using the node package manager (npm) command-line tool, this will allow you to run a web server from anywhere on your computer.
一般要建置 web server 都是用 apache 或 nginx,不過開發程式有時只是要簡單測試個網頁而已, NodeJS 有套件可以滿足這個需求,簡單寫個筆記. 今天要用的套件為 http-server. Github. 安裝指令. 目前電腦有個 html 檔,路徑在 c:\13f\2021Q4\buffett.html,我需要在 web server 下看到它,只需要執行執行. 預設 port 是 8080,但如果 8080 已經被使用過的話,會自動幫你找可以用的 por
[path] defaults to ./public if the folder exists, and ./otherwise. Now you can visit http://localhost:8080to view your server Note: Caching is on by default. Add -c-1as an option to disable caching. 在「npmjs.com」查看更多資訊 在「npmjs.com」查看更多資訊 To implement a ca